package cn.customrpc.client;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.apache.log4j.chainsaw.Main;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import cn.customrpc.domain.Order;
import cn.customrpc.domain.Ship;
import cn.customrpc.interfaces.OrderService;
import cn.customrpc.tools.RpcProxy;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-client-config.xml")
public class OrderServiceTest {

	@Autowired
	private RpcProxy rpcProxy;

	@Test
	public void getOrderTest() {
		OrderService orderService = rpcProxy.create(OrderService.class);
		Order order = new Order();
		order.setOrderId(35454545);
		Ship ship = orderService.getOrder(order, "1238888");
		System.out.print("shipId:"+ship.getShipId());
	}
	
	@Test
	public void test() throws UnknownHostException{
		InetAddress addr = InetAddress.getLocalHost();
		String ip=addr.getHostAddress();//获得本机IP
		System.out.println("ip:"+ip);
	}
}
